#include <assert.h>     /* assert */

#pragma once
class Color
{
public:
	Color():r(0),g(0),b(0){}

	///<summary>[0,1]</summary>
	float r;
	///<summary>[0,1]</summary>
	float g;
	///<summary>[0,1]</summary>
	float b;

	void limitRange(Color &c) const
	{
		if(c.r>1)
			c.r=1;
		if(c.g>1)
			c.g=1;
		if(c.b>1)
			c.b=1;
	}

	Color operator + ( const Color& v ) const
	{
		assert(r>=0);
		assert(g>=0);
		assert(b>=0);


		Color c;
		c.r=r+v.r;
		c.g=g+v.g;
		c.b=b+v.b;

		limitRange(c);


		return c; 
	}


	Color operator * (const float& n) const
	{
		Color c;
		c.r=r*n;
		c.g=g*n;
		c.b=b*n;

		limitRange(c);

		return c;

	}
};

